package com.svse.designPattern.behaviour.state.service;

import com.svse.designPattern.behaviour.state.context.ScoreContext;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/8 11:18
 */
abstract public class AbstractState {
    /**
     * 环境
     */
    public ScoreContext context;
    /**
     * 状态名
     */
    public String stateName;
    /**
     * 分数
     */
    public int score;

    /**
     *  检查当前状态
     */
    public abstract void checkState();

    public void addScore(int x){
        score+=x;
        System.out.print("加上："+x+"分，\t当前分数："+score );
        checkState();
        System.out.println("分，\t当前状态："+context.getAbstractState().stateName);
    }
}
